<?php
 class LoginAction extends Action{
 	public function index(){
 		$this->display();
 	}

 	// 登陆
 	public function login(){
 		$user=M('User');
 		$_POST['password']=md5($_POST['password']);
 		$row=$user->where($_POST)->find();
 		if($row){
 			$_SESSION['home_login']=1;
 			$_SESSION['home_user_id']=$row['id'];
 			$_SESSION['home_username']=$row['username'];
 			$this->redirect('Index/index');
 		}
 	}

 	// 退出
 	public function logout(){
 		$_SESSION=array();
 		$this->redirect('Index/index');
 	}
 }
?>